import React from "react"
import classNames from "classnames"
import { FontAwesomeIcon, FontAwesomeIconProps } from "@fortawesome/react-fontawesome"
import { fas } from '@fortawesome/free-solid-svg-icons';
import { library } from "@fortawesome/fontawesome-svg-core";

library.add(fas);
export type ThemeProps = "primary" | "secondary" | "success" | "info" | "warning" | "danger"

export interface IconProps extends FontAwesomeIconProps {
    /**
     * 主题
     */
    theme ?: ThemeProps
}

export const Icon: React.FC<IconProps> = (props) =>{

    const { className, theme, ...resetProps } = props
    const classes = classNames("wave-icon", className, {
        [`wave-icon-${theme}`]: theme
    })
    return (
        <FontAwesomeIcon className={classes} {...resetProps} />
    )
}

